import { PageContainer } from '@ant-design/pro-components';
import { Row, Col } from 'antd';
import {
  // FooterToolbar,
  // ModalForm,
  // ProDescriptions,
  // ProFormText,
  // ProFormTextArea,
  ProTable,
} from '@ant-design/pro-components';
import type { ProColumns } from '@ant-design/pro-components';
import React, { useRef, useState } from 'react';
import { getPoints } from '@/services/ant-design-pro/api';

const Score: React.FC = () => {
  const actionRef = useRef();
  const [, setSelectedRows] = useState<API.OrderData[]>([]);
  const columns: ProColumns<API.PointData>[] = [
    {
      title: '流水号',
      dataIndex: 'SerialNum',
      tooltip: '授权请求的流水号',
    },
    {
      title: '门架',
      dataIndex: 'PortalName',
      sorter: true,
    },
    {
      title: '门架编号',
      dataIndex: 'PortalCode',
    },
    {
      title: '组织',
      sorter: true,
      dataIndex: 'Owner',
    },
    // {
    //   title: '授权时间',
    //   sorter: true,
    //   dataIndex: 'AuthTime',
    //   valueType: 'dateTime',
    // },
    {
      title: '积分',
      sorter: true,
      dataIndex: 'Point',
    },
  ];

  return (
    <PageContainer>
      <Row gutter={[16, 10]}>
        <Col flex={'auto'}>
          <ProTable<API.PointData, API.PageParams>
            headerTitle={'积分列表'}
            actionRef={actionRef}
            rowKey={'ID'}
            search={false}
            options={false}
            columns={columns}
            request={getPoints}
            pagination={{
              defaultPageSize: 5,
              showSizeChanger: true,
            }}
            rowSelection={{
              onChange: (_, selectedRows) => {
                setSelectedRows(selectedRows);
              },
            }}
          />
        </Col>
      </Row>
    </PageContainer>
  );
};

export default Score;
